<!DOCTYPE html>
<html>
    <head>
        <title>个人信息</title>
        <meta charset="utf-8">
        <link href="css/register.css" type="text/css" rel="stylesheet">
        <script type="text/javascript" src="js/jquery.min.js" ></script>
    </head>
    <body>
        <div id="layout">
            <span>手机验证</span>
            <form method="get" id="frm">
            <ul>
                <p id="err_msg"></p>
                <li><i class="un"><img src="images/user_name.png"></i><input class="username" type="text" name="name" placeholder="请输入姓名" /></li>
                <li><i class="pw"><img src="images/user_name.png"></i><input class="pwd" type="phone" name="phone" placeholder="请输入手机号" /></li>
                <li><i class="yz"><img src="images/msg.png"></i><input class="yzm" type="text" name="yzm" placeholder="请输入手机验证码" /><input type="button" id="send" value="获取验证码" /></li>
                <div class="queren"><input class="fx" type="checkbox" checked="checked" /><p>我已阅读并同意《用户协议》</p></div>
            </ul>
                <div class="reg_btn">
                    <button class="submit" type="button" id="reg">确认</button>
                </div>
            </form>
        </div>
        <script>
            $(function(){
                var send=document.getElementById('send'),
                    times=60,
                    timer=null;
                send.onclick=function(){
                    // 计时开始
                    timer = setInterval(djs,1000);
                }
                function djs(){
                    send.value = times+"秒后重试";
                    send.setAttribute('disabled','disabled');
                    send.style.background='#ccc';
                    send.style.border='1px solid #ccc';
                    times--;
                    if(times <= 0){
                        send.value = "发送验证码";
                        send.removeAttribute('disabled');
                        times = 60;
                        clearInterval(timer);
                    }
                }
                //发送验证码
               $("#send").click(function () {
                    var tel = $("input[class=pwd]").val();
                    /!*发送ajax到后端发送验证码*!/
                    $.ajax({
                        url:"/weixin/user/sendVercode",
                        //传输到后端的数据
                        data:{"tel":tel},
                        dataType:"text",
                        success:function(data){
                        }
                    });
                })
                //发送登录验证，验证验证码
                $("#reg").click(function () {
                    location.href="okpage.html";
                    // var frm = $("#frm").serialize();
                    // console.log(frm);
                    // /!*发送ajax到后端发送验证码*!/
                    // $.ajax({
                    //     url:"/weixin/user/checkVercode",
                    //     //传输到后端的数据
                    //     data:frm,
                    //     dataType:"text",
                    //     success:function(data){
                    //         console.log(data);
                    //         var j = JSON.parse(data);
                    //         if(j.message == "success"){
                    //             // alert("注册成功");
                    //             location.href="okpage.html";
                    //         }else{
                    //             alert("注册失败");
                    //         }
                    //
                    //     }
                    // });
                })
            });

        </script>
    </body>
</html>